package com.sz.biz.logistics.serialno.dto;

import com.sz.biz.logistics.serialno.utils.SerialNumberRangeResolve;
import lombok.Data;

/**
 * Package: com.sz.biz.logistics.channelno.dto<br>
 * Description: 手动分配单号DTO<br>
 * @author WuHan<br>
 * @date 2017-12-10 21:36<br>
 * @serial
 * @since ${TAG}
 */
@Data
public class ManualSetupSectionDto implements Comparable<ManualSetupSectionDto> {
    
    private Integer ruleId;
    
    private String name;
    
    private String format;
    
    private String refUid;

    private Integer refId;

    private Integer refCustomer;
    
    private String pattern;
    
    private String postFix;
    private String prefix;
    private String serialNumber;
    
    private String startNumber;
    
    private String endNumber;
    
    private String verifyRule;
    
    @Override
    public int compareTo(ManualSetupSectionDto o) {
        if (SerialNumberRangeResolve.offsetCalculate(endNumber,prefix,serialNumber,postFix) - SerialNumberRangeResolve
                .offsetCalculate(startNumber,prefix,serialNumber,postFix) > SerialNumberRangeResolve.offsetCalculate
                (o.endNumber,o.prefix,o.serialNumber,o.postFix) - SerialNumberRangeResolve.offsetCalculate(o.startNumber,
                o.prefix,o.serialNumber,o.postFix)) {
            return 1;
        }
        return -1;
    }
}
